package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * Package: com.atguigu.lease.common.minio
 *
 * @Description:
 * @Author xiongkunYang
 * @Create 2025/4/30 14:55
 */
@SpringBootConfiguration
@EnableConfigurationProperties({MinioClientProperties.class})
@RequiredArgsConstructor
public class MinioConfiguration {

    private final MinioClientProperties minioClientProperties;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioClientProperties.getEndpoint())
                .credentials(minioClientProperties.getAccessKey(), minioClientProperties.getSecretKey())
                .build();
    }

}